﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace assistant
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        private void exit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void logining_Click(object sender, EventArgs e)
        {
            if (User.Text == "")
            {
                MessageBox.Show("用户名不能为空！");
                User.Select();
            }
            else if(Password.Text=="")
            {
                MessageBox.Show("密码不能为空！");
                Password.Select();
            }
            else
            {
                if (User.Text == "admin" && Password.Text == "admin")
                {
                    log.Text = "正在登录。。。";
                    MessageBox.Show("登陆成功！");
                    this.Hide();
                    index index = new index();
                    index.Show();
                }
                else
                {
                    MessageBox.Show("用户名或密码错误，请重新登陆！");
                    Password.Text = "";
                    Password.Select();
                }
            }
        }

        private void register_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
            Register register = new Register();
            register.Show();
        }

        private void forget_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
            Forget forget = new Forget();
            forget.Show();
        }
    }
}
